<template>
    <span class="text">
        <span class="name name_act"  contenteditable="true" v-if="item.value" >{{item.value}}</span>
        <span class="name" contenteditable="true" v-else>{{item.indexName}}</span>
        <ul>
            <li>
                <div class="select_item">
                    <input type="radio" value=" 精神状态好"><div class="select_item_text">精神状态好</div>
                </div>
            </li>
            <li>
                <div  class="select_item">
                    <input type="radio" value=" 精神状态稍差"><div class="select_item_text">精神状态稍差</div>
                </div>
            </li>
            <li>
                <div  class="select_item">
                    <input type="radio" value=" 精神状态明显差"><div class="select_item_text">精神状态明显差</div>
                </div>
            </li>
        </ul>
    </span>
</template>
<script>
export default {
    props: {
        item: {
            type: Object,
            default: ()=>{
                return {
                    type: 'SingleChoice',
                    indexName:"当前精神状态",
                    isAnswered:false, 
                    value:'咳臭痰',
                    values:[
                        {
                        id:0,
                        text: "咳臭痰",
                        value: "咳臭痰",
                        optionText: "咳臭痰"
                        },
                        {
                        id:0,
                        text: "痰液无异味",
                        value: "痰液无异味",
                        optionText: "痰液无异味"
                        },
                    ]
                }
            },
        },    
    },
}
</script>
<style lang="scss" scoped>
.text{
    position: relative;
    ul{
        position: absolute;
        right: 0;
        top: 20px;
        display: none;
    }
}
.text:hover ul{
    display: block;
}
ul{
    margin: 0;
    padding: 0;
    background-color: #fff;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 #eee;
}
.name{
    outline: none;
    padding: 2px;
    color: #999;
    line-height: 20px;
    border-radius: 5px;
    margin-bottom: 1px;
    margin-right: 1px;
}
.name_act{
    color: #333;
}
.text:hover{
    background: #eee;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    position: relative;
    z-index: 22;
}

li{
    width: 100%;
    list-style: none;
    line-height: 36px;
    margin: 0;
    font-size: 14px;
    color: #606266;
    cursor: pointer;
    outline: 0;
    padding: 0 10px;
    box-sizing: border-box;
    .select_item{
        display: flex;
        align-items: center;
        width: 100%;
    }
}
li:hover{
    background: #ecf6ff;
    div{
        color: #5294fe;
    }
}
</style>